﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;

namespace EuroManager.Presentation.WebPortal.GameViewer
{
    public partial class MainPage : UserControl
    {
        private MainViewModel viewModel;

        public MainPage()
        {
            InitializeComponent();

            DataContext = viewModel = new MainViewModel();
            CompositionTarget.Rendering += new EventHandler(OnRendering);
        }

        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Event handler for control in XAML")]
        private void OnStartClick(object sender, RoutedEventArgs e)
        {
            viewModel.StartCommand.Execute(App.GetInitParam("GameData"));
        }

        private void OnRendering(object sender, EventArgs e)
        {
            viewModel.UpdateFrameCommand.Execute(null);
        }
    }
}
